﻿<Dialogs:Dialog x:Class="Supremacy.Client.Views.NewShipSelectionView"
             x:Name="_self"
             x:FieldModifier="private"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:s="http://schemas.startreksupremacy.com/xaml/core"
             xmlns:sx="clr-namespace:Supremacy.Xna;assembly=Supremacy.Xna"
             xmlns:local="clr-namespace:Supremacy.Client"
             xmlns:Dialogs="clr-namespace:Supremacy.Client.Dialogs"
             xmlns:Commands="clr-namespace:Supremacy.Client.Commands"
             mc:Ignorable="d"
             d:DesignHeight="640"
             d:DesignWidth="840"
             Height="640"
             Width="860"
             Foreground="White"
             FontSize="16"
             UseLayoutRounding="True">

  <Dialogs:Dialog.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/SupremacyClient;Component/Themes/Federation/TechObjectInfo.xaml" />
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </Dialogs:Dialog.Resources>
  
  <Dialogs:Dialog.CommandBindings>
    <CommandBinding Command="{x:Static Commands:DialogCommands.AcceptCommand}" CanExecute="CanExecuteAcceptCommand" Executed="ExecuteAcceptCommand" />
  </Dialogs:Dialog.CommandBindings>
  <!--
      MAIN CONTENT
    -->
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="*" />
      <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <TextBlock Grid.ColumnSpan="2"
               FontFamily="{StaticResource {x:Static local:ClientResources.HeaderFontFamilyKey}}"
               Foreground="Black"
               Margin="1,1,0,0"
               FontSize="24pt"
               Text="SELECT A SHIP TO CONSTRUCT" />
    <TextBlock Grid.ColumnSpan="2"
               FontFamily="{StaticResource {x:Static local:ClientResources.HeaderFontFamilyKey}}"
               Foreground="{StaticResource {x:Static local:ClientResources.HeaderTextForegroundBrushKey}}"
               FontSize="24pt"
               Text="SELECT A SHIP TO CONSTRUCT" />

    <ListBox x:Name="BuildProjectList"
             Grid.Row="1"
             Margin="0,6,0,0"
             PreviewMouseDoubleClick="OnBuildProjectListMouseDoubleClick"
             SelectedItem="{Binding ElementName=_self, Path=SelectedBuildProject, Mode=OneWayToSource}">
      <ItemsControl.ItemTemplate>
        <DataTemplate DataType="{x:Type s:BuildProject}">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="3*"/>
              <ColumnDefinition Width="1*" />
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Path=BuildDesign.Name}" />
            <TextBlock Grid.Column="2"
                       Text="{Binding Path=TurnsRemaining, StringFormat={local:StringResource Key=BUILD_QUEUE_TURNS_REMAINING_FORMAT}}"
                       TextAlignment="Right" />
          </Grid>
        </DataTemplate>
      </ItemsControl.ItemTemplate>
    </ListBox>

    <DockPanel Grid.Column="1"
               Grid.RowSpan="2"
               LastChildFill="True"
               Width="360"
               Margin="22,0,0,0">
      <sx:ShipModelViewer DockPanel.Dock="Top"
                          Height="240"
                          CameraDistanceMultiplier="2"  
                          ModelFile="{Binding ElementName=BuildProjectList, Path=SelectedItem.BuildDesign.ModelFile}" />

      <ScrollViewer Margin="0,15,0,0"
                    VerticalScrollBarVisibility="Auto">
        <ContentControl Style="{DynamicResource TechObjectInfoPanelStyle}"
                        Content="{Binding ElementName=_self, Path=AdditionalContent}" />
      </ScrollViewer>

    </DockPanel>
    
    <StackPanel Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Orientation="Horizontal" Margin="0,15,0,0">
      <Button Margin="3,0,3,0"
              IsDefault="True"
              Focusable="True"
              Command="{x:Static Commands:DialogCommands.AcceptCommand}"
              Style="{DynamicResource {x:Static local:ClientResources.MessageDialogButtonStyleKey}}">
        <AccessText Text="{local:StringResource Key=MESSAGE_DIALOG_OK, Case=Upper}" />
      </Button>
      <Button Margin="3,0,3,0"
              IsCancel="True"
              Style="{DynamicResource {x:Static local:ClientResources.MessageDialogButtonStyleKey}}">
        <AccessText Text="{local:StringResource Key=MESSAGE_DIALOG_CANCEL, Case=Upper}" />
      </Button>

    </StackPanel>

  </Grid>

</Dialogs:Dialog>